package rehab.tutor.androidclient;

import rehab.tutor.androidclient.service.OauthTokenValidatorService;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;

public class StartActivity extends Activity {

	private static StartActivity START_ACTIVITY;
	public static StartActivity getInstance(){ return START_ACTIVITY; }
	
	private Button test;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.main);
		initGUI();
	}

	private void initGUI() {
		test = (Button) findViewById(R.id.test);
		OnClickListener listener3 = new OnClickListener() {
			@Override
			public void onClick(View v) {
				
				//TODO Service per prendere il token e autenticarsi al sistema
				
				/*** AVVIO IL SERVICE: ***/ 
				startService(new Intent(StartActivity.getInstance(), OauthTokenValidatorService.class));
				
				Intent intent = new Intent(getApplicationContext(),
						TestActivity.class);
				startActivity(intent);
			}
		};
		test.setOnClickListener(listener3);

	}

	@Override
	public void onBackPressed() {
		finish();
	}


}
